// import { subjectModulesMap } from "@/utils/constant";

export const formatBaseInfo = (data: any): Array<any> => {
  if (!data) return [];
  const { eqpId, areaId, eeOwner, eePhone, chambers, eqpName, columnPlace, peOwner, pePhone, eqpRelationList } = data;
  const relationValue = () => {
    if (eqpRelationList?.length) {
      const list = eqpRelationList.reduce((pre, cur) => {
        const { takeOffs = [], twoSystemName = "" } = cur;
        if (!!takeOffs[0] && !pre.includes(takeOffs[0])) {
          pre.push(takeOffs[0]);
        }
        if (!!twoSystemName && !pre.includes(twoSystemName)) {
          pre.push(twoSystemName);
        }
        return pre;
      }, []);
      return list.join("， ");
    } else {
      return "--";
    }
  };
  // let tags = [];
  // tags = deviceStatus?.split(",");
  // if (isAlarm) tags?.push("Alarm");
  // tags = tags?.map(item => item?.toLowerCase());
  // const a = {
  //   id: "1",
  //   type: "tag",
  //   label: "状态",
  //   tags: tags,
  //   value: ""
  // };
  const a = {
    id: "1",
    type: "default",
    label: "机台编号",
    value: eqpId
  };
  const b = {
    id: "2",
    type: "default",
    label: "区域",
    value: areaId
  };
  const c = {
    id: "3",
    type: "default",
    label: "设备工程师",
    value: eeOwner
  };
  const d = {
    id: "4",
    type: "default",
    label: "值班电话",
    value: eePhone
  };

  const e = {
    id: "2",
    type: "default",
    label: "机台名称",
    value: eqpName
  };
  const f = {
    id: "2",
    type: "default",
    label: "柱位",
    value: columnPlace
  };
  const g = {
    id: "2",
    type: "default",
    label: "工艺工程师",
    value: peOwner
  };
  const h = {
    id: "4",
    type: "default",
    label: "值班电话",
    value: pePhone
  };

  const i = {
    id: "6",
    type: "default",
    label: "关联系统",
    value: relationValue()
  };

  const j = {
    id: "2",
    type: "default",
    label: "Chamber",
    value: chambers?.length ? chambers.map(item => item.chamberName).join("， ") : "--"
  };
  return [a, b, c, d, e, f, g, h, i, j];
};
